package com.ooqiu.gaming.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;


public class SettingPrefUtil {

    public static boolean isGifAutoPlay(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("gif_auto_play", false);
    }

    public static boolean isVideoAutoPlay(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("video_auto_play", false);
    }
    public static boolean isAllow4G(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("allow_4g", false);
    }


    public static boolean isAllowNewsPush(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("allow_push_news", false);
    }
    public static boolean isAllowApplyPush(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("allow_push_apply", false);
    }
    public static boolean isAllowNightPush(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getBoolean("allow_push_night", false);
    }

    public static void setGifAutoPlay(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("gif_auto_play", allow).apply();
    }
    public static void setVideoAutoPlay(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("video_auto_play", allow).apply();
    }
    public static void setAllow4G(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("allow_4g", allow).apply();
    }
    public static void setAllowNewsPush(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("allow_push_news", allow).apply();
    }
    public static void setAllowApplyPush(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("allow_push_apply", allow).apply();
    }

    public static void setAllowNightPush(Context context, boolean allow) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putBoolean("allow_push_night", allow).apply();
    }
    public static void setIndexAlertTime(Context context, Long time) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefs.edit().putLong("index_alert_time", time).apply();
    }
    public static Long getIndexAlertTime(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        return prefs.getLong("index_alert_time", 0);
    }


}
